package com.pac.weixin.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pac.weixin.bean.WxUserBean;
import com.pac.weixin.dao.WxUserDao;

/**
 * 微信用户信息dao实现
 * 
 * @author lujun.chen
 * @version [版本号, 2015年3月27日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Repository(value = "wxUserDao")
public class WxUserDaoImpl implements WxUserDao {
	
	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public String addWxUser(WxUserBean wxUserBean) {
		sqlSessionTemplate.insert("addWxUser", wxUserBean);
		return wxUserBean.getId();
	}

	@Override
	public boolean delWxUser(WxUserBean wxUserBean) {
		int n=sqlSessionTemplate.delete("delWxUser", wxUserBean);
		return n>0;
	}

	@Override
	public boolean updateWxUser(WxUserBean wxUserBean) {
		int n=sqlSessionTemplate.update("updateWxUser", wxUserBean);
		return n>0;
	}

	@Override
	public List<WxUserBean> queryWxUser(WxUserBean wxUserBean) {
		return sqlSessionTemplate.selectList("queryWxUser", wxUserBean);
	}

}
